package com.example.SpringCloudDemo.map;

import java.util.HashMap;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.Map;

public class text {

    public static void main(String[] args) {
        Map<String,Object> map = new HashMap<>();
        new Hashtable<>();
        map.put("name","南粤通");
        map.put("scale","50-100人");
        map1(map);
        map2(map);
        map3(map);
        map4(map);
    }

    static void map1(Map<String,Object> map){
        for(String key : map.keySet()){
            System.out.println(key+"=="+map.get(key));
        }
        System.out.println("---------------------");
    }

    static void map2(Map<String,Object> map){
        Iterator<Map.Entry<String,Object>> entryIterator = map.entrySet().iterator();
        while (entryIterator.hasNext()){
            Map.Entry<String,Object> entry = entryIterator.next();
            System.out.println(entry.getKey()+"=="+entry.getValue());
        }
        System.out.println("---------------------");
    }

    static void map3(Map<String,Object> map){
        for(Map.Entry<String,Object> entry : map.entrySet()){
            System.out.println(entry.getKey()+"=="+entry.getValue());
        }
        System.out.println("---------------------");

    }

    static void map4(Map<String,Object> map){
        for(Object value : map.values()){
            System.out.println(value);
        }
    }
}
